package com.eclink.asset.setup.convert;

import cn.hutool.core.bean.BeanUtil;
import com.eclink.asset.setup.domain.dao.Company;
import com.eclink.asset.setup.domain.dto.CompanyDTO;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 组织架构
 *
 * @author chenshixian
 */
@Component
public class OrganizationConvert {

    /**
     * @param source DO
     * @return DTO
     */
    public List<CompanyDTO> do2dto(List<Company> source) {
        List<CompanyDTO> res = new ArrayList<>();
        for(Company company : source) {
            CompanyDTO dto = new CompanyDTO();
            BeanUtil.copyProperties(company, dto);
            res.add(dto);
        }
        return res;
    }


}
